1. Field of the Invention
The present invention relates to encoding of video data, and more particularly, to a prediction method and apparatus for video encoding.
2. Description of the Related Art
FIG. 1 is a block diagram illustrating an H.264 encoder. Referring to FIG. 1, the H.264 encoder includes a prediction unit 110, a transformation and quantization unit 120, and an entropy encoding unit 130.
The prediction unit 110 performs inter-prediction and intra-prediction. Inter-prediction, or inter-picture prediction, is a process of predicting a block of a current picture based on a corresponding block of a reference picture, which is stored in a buffer after being decoded and then deblocking-filtered. For performing an inter-prediction, the prediction unit 110 includes a motion estimator 111 and a motion compensator 112. On the other hand, intra-prediction, or an intra-picture prediction, is a process of predicting a predetermined block of a picture that has already been decoded, by using pixel data of blocks adjacent to the predetermined block.
The transformation and quantization unit 120 transforms and quantizes a sample block predicted by the prediction unit so that the sample block is compressed. The entropy coding unit 130 entropy-codes quantized video data in the form of an H.264 bitstream.
FIG. 2 is a diagram illustrating the structure of a group of pictures (GOP) 200. A set of pictures starting with an intra-coded picture (referred to as an I picture) is called a GOP. More specifically, a GOP of MPEG video data is comprised of three different types of pictures, i.e., an I picture, which is a compressed still picture, predictive pictures (referred to as P pictures), which are obtained by a forward prediction, and bidirectionally predictive pictures (referred to as B pictures), which are obtained by forward and backward predictions and a bi-directional prediction. In a GOP, an I picture is encoded without reference to P or B pictures.
The P pictures are encoded or decoded using information of their respective previous I and P pictures. The concept of such P picture encoding is based on the fact that in most cases, consecutive pictures of motion picture data are not so much different from one another that they more than often represent small movements or minor changes of picture blocks rather than dramatic ones. Therefore, since there are small movements of the picture blocks, if any, the consecutive pictures can be encoded by simply encoding differences among them.
The B pictures are encoded and decoded using information on their respective previous I and P pictures and subsequent I and P pictures. In such B picture encoding, a high compression rate can be achieved. Each of the B pictures is generated using a difference between its previous I and P pictures and a difference between its subsequent I and P pictures.
A motion picture encoder that adopts H.263 of the international Telecommunication Union Telecommunication Standardization Sector (ITU-T) or MPEG-2/4 of the International Standardization Organization (ISO)/the International Electronics Commission (IEC) determines a motion prediction mode for a P picture by performing inter-prediction using a result of performing a motion estimation on the P picture on a macroblock-by-macroblock basis and calculating a cost using a predetermined cost function. The cost can be calculated in various manners, for example, using a motion compensation error, i.e., a sum of absolute differences (SAD). More specifically, the motion picture encoder selects an inter-prediction mode if the SAD is smaller than a characteristic value of a current macroblock, such as a variance of values of pixels of the macroblock, and selects an intra-prediction mode if the SAD is not smaller than the characteristic value of the current macroblock.
A motion picture encoder that adopts H.264 of ITU-T or MPEG-4 AV of ISO/IEC determines a motion prediction mode for a P picture by performing both inter-prediction and intra-prediction operations. In other words, intra-prediction and inter-prediction are performed on every macroblock of the P picture, and then a cost obtained as a result of the intra-prediction and a cost obtained as a result of the inter-prediction are compared. Thereafter, the one with a smaller cost is selected between an inter-prediction mode and an intra-prediction mode.
The above-mentioned H.264 intra-prediction method provides thirteen prediction modes. More specifically, in the H.264 intra-prediction method, the thirteen prediction modes are broadly classified into nine 4×4 block prediction modes and four 16×16 block prediction modes according to the size of blocks to be predicted. The 4×4 block prediction modes or the 16×16 block prediction modes are differentiated from one another according to a prediction direction in which a predicted sample block is obtained using pixel values of blocks adjacent to a given 4×4 block to be predicted. In the H.264 intra-prediction method, intra-prediction is performed using each of the thirteen prediction modes, a prediction mode with the smallest cost is selected among the thirteen prediction modes, and then the smallest cost is compared with a cost obtained as a result of inter-prediction, which results in a considerable amount of computation.